package cn.kbyue.exceptiondemo.common;

import cn.kbyue.exceptiondemo.common.enums.CommonResponseEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 限定了类返回分页信息
 * 类名可简写为 QR 方便使用
 * @param <T>
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class QueryDataResponse<T> extends CommonResponse<QueryData<T>> {

    public static <T> QueryDataResponse<T> success(QueryData<T> data) {
        QueryDataResponse<T> queryData = new QueryDataResponse<>();
        queryData.setData(data);
        queryData.setCode(CommonResponseEnum.SUCCESS.getCode());
        queryData.setMessage(CommonResponseEnum.SUCCESS.getMessage());
        return queryData;
    }
}
